package com.gali.medical.controller;

import com.gali.medical.pojo.CheckItem;
import com.gali.medical.service.CheckItemService;
import com.gali.medical.utils.PageResult;
import com.gali.medical.utils.QueryPageBean;
import com.gali.medical.utils.Result;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.*;

/**
 * @author gali
 * @description:
 * @date 2022/6/25 11:00
 */
@RestController
@RequestMapping("/checkItem")
public class CheckItemController {

   @Reference
   CheckItemService checkItemService;

    /**
     * 增加项目组
     * @param checkItem
     * @return
     */
    @PostMapping("/addCheckItem")
    public Result addCheckItem(@RequestBody CheckItem checkItem){
        return checkItemService.addCheckItem(checkItem);
    }

    /**
     * 分页查询
     * @param queryPageBean
     * @return
     */
    @PostMapping("/findItemInfo")
    public PageResult findItemInfo(@RequestBody QueryPageBean queryPageBean){
        return checkItemService.findItemInfo(queryPageBean);
    }

    /**
     * 删除检查组
     * @param id
     * @return
     */
    @DeleteMapping("/deleteItem")
    public Result deleteItem(@RequestParam("id") Integer id){
        return checkItemService.deleteItem(id);
    }

    /**
     * 更新检查组
     * @param checkItem
     * @return
     */
    @PutMapping("/updateItem")
    public Result updateItem(@RequestBody CheckItem checkItem){
        return checkItemService.updateItem(checkItem);
    }

    /**
     * 根据id查询项目组
     * @param id
     * @return
     */
    @GetMapping("/findOneItem")
    public Result findOneItem(@RequestParam("id")Integer id){
        return checkItemService.findOneItem(id);
    }
}
